A pattern projection method has been known in which an object, onto which patterned light is projected several times, is captured to measure a shape of the object from a deformation of the pattern using the principle of triangulation. Among others, a spatial coding method, in which a stripe light pattern that a light and a dark portion are alternately arranged at given intervals is projected and space is binary-coded, has been frequently used in a three dimensional measurement.
FIG. 13 illustrates a configuration of an object shape measuring apparatus and a concept of a measuring method using the spatial coding method. In general, the shape measuring apparatus includes a projector 130 for projecting a pattern onto an object to be measured and a camera 131 for capturing a reflected pattern. The projector 130 projects a stripe light pattern that a light and a dark portion are alternately arranged at given intervals onto an object 132. The stripe light pattern has a predetermined plurality of pattern shapes and each of which is projected onto the object 132.
The object 132 onto which the plurality of pattern shapes are projected are captured to acquire image data. In FIG. 13, a boundary position of the light and dark portions of the object 132 is taken as (X, Y, Z). The ray positions of the projector 130 and the camera 131 determined by connecting the boundary position (X, Y, Z) to the projector 130 and the camera 131 are taken as (X1, Y1) and (X2, Y2) respectively.
The ray position of the camera 131 (X2, Y2) can be determined by the horizontal coordinate of an image sensor (a CCD sensor or a CMOS sensor) of the camera 131. The horizontal coordinate is determined by a horizontal and a vertical width of the image sensor. A 640*480 pixel image sensor, for example, the x coordinate in the horizontal direction has values of 0 to 640 and the y coordinate in the vertical direction has values of 0 to 480.
The ray position of the projector 130 (X1, Y1) can be similarly determined by the horizontal coordinate of a light projecting sensor (a CCD sensor or a CMOS sensor). A base length L between the projector 130 and the camera 131 is determined from the configurative conditions of the apparatus. The boundary position (X, Y, Z) of the object 132 can be determined from these parameters using the principle of triangulation. Determining the boundary positions (X, Y, Z) on all over the object 132 allows measuring the three dimensional shape of the object 132.
The shape of the stripe light pattern used for measurement is described below. FIGS. 14A, 14B, and 14C illustrate binary coded stripe light pattern in which a light and a dark portion are alternately arranged at equal intervals. A black portion of a reflective pattern corresponds to zero, and a white portion thereof corresponds to one.
In FIG. 14A, the whole area is divided into two portions and two areas are coded as 1 and 0. In FIG. 14B, each of the halved areas is further halved and four areas are coded as 1, 0, 1, and 0. The corresponding stripe light pattern is projected and captured.
In FIG. 14C, each of the quadrant areas is halved and eight areas are coded as 1, 0, 1, 0, 1, 0, 1, and 0. The corresponding stripe light pattern is projected and captured. Thus, each area is provided with a coded area number to allow each area to be determined.
In FIGS. 14A, 14B, and 14C, each area can be determined as (1, 1, 1), (1, 1, 0), (1, 0, 1), (1, 0, 0), (0, 1, 1), (0, 1, 0), (0, 0, 1), and (0, 0, 0). This is referred to as space coding by three bits. When a shape is measured in detail, n stripe light patterns are projected while areas are sequentially being halved, and area numbers in which areas onto which the projector projects stripe light patterns are divided into 2n (the n power of 2) are provided to allow each area to be determined. In a general three dimensional measurement, an 8- or a 9-bit coding is performed.
In FIG. 14C, the light and dark portions are the smallest in width. The stripe light pattern is referred to as an LSB pattern light. The width of the light and dark portions is referred to as the minimum width. The size of the minimum width can be determined based on the horizontal width W and the bit number of the image sensor. In the spatial coding by N bit, the minimum width=W/(2n).
The spatial coding can use a binary code called a gray code with a coding error resilience instead of a simple binary code in FIGS. 14A, 14B, and 14C. FIGS. 15A, 15B, and 15C illustrate gray codes. In FIG. 15A, two areas are coded as 1 and 0. In FIG. 15B, four divided areas are coded as 1, 0, 0, and 1. In FIG. 15C, eight divided areas are coded as 1, 0, 0, 1, 1, 0, 0, and 1.
Even in the gray code, the concept of the minimum width is similarly obtained as the minimum width=W/(2n). The use of the gray code does not cause a coding error in a global area even if a coding error occurs in the boundary between areas due to displacement or blur of a spatial coding pattern. In general, the spatial coding method uses the gray code.
It is necessary to accurately determine a horizontal x-coordinate position (hereinafter referred to as a boundary position) between the light and dark portions from the captured image data to improve accuracy in the three dimensional measurement of the spatial coding method. FIGS. 16A and 16B are charts describing the boundary position between the light and dark portions. FIGS. 16B and 16C are graphs illustrating the luminance of the captured image data and the horizontal coordinate x.
FIG. 16A illustrates an idealistic boundary position. In FIG. 16A, the boundary position between the light and dark portions is uniquely determined and positions “a” and “b” are determined as boundary positions. In an actual measurement, however, as illustrated in FIG. 16B, a gentle straight line is formed in the vicinity of boundary positions due to blur of the spatial coding pattern, reflectance ratio of an object, and influence of external light, which makes it difficult to uniquely determine boundary positions.
A method for determining the abovementioned boundary position is discussed in Non-Patent Literature 1 (Seishi Iguchi and Kousuke Sato, “Three Dimensional Image Measurement,” pp. 80 to 91, Shokodo, 1990) and Non-Patent Literature 2 (The Institute of Electronics, Information and Communication Engineers (IEICE) TRANSACTIONS, D Vol. J71-D, No. 7, pp. 1249 to 1257).
FIGS. 17A and 17B illustrate an average image comparison method, which is one of methods for determining the abovementioned boundary position. FIG. 17A illustrates stripe light pattern to be projected. The stripe light pattern 20 is the light pattern spatially coded by a 3-bit gray code. A whole illumination pattern 23 only with a light portion and a whole blackout pattern 24 only with a dark portion are prepared as pattern light. The five different stripe light patterns are projected onto an object, and the object onto which the stripe light patterns are projected is captured.
FIG. 17B is a graph illustrating a relationship between the luminance of the captured image data and the horizontal coordinate x. A luminance line 173 is the luminance line in the vicinity of boundary position of image data captured using any of the stripe light pattern 20. A luminance line 174 is the luminance line of image data captured using the whole illumination pattern 23. A luminance line 175 is the luminance line of image data captured using the whole blackout pattern 24.
The luminance lines 174 and 175 are averaged to obtain an average as a luminance line 176. The luminance line 173 of the stripe light pattern 20 and the luminance line 176 of the average intersect with each other at a position “a”. The position “a” determined by the above process is taken as a boundary position. What is described above is the average image comparison method.
FIGS. 18A and 18B illustrate a complementary pattern projection method, which is one of methods for determining the abovementioned boundary position. FIG. 18A illustrates stripe light pattern to be projected. The stripe light pattern 20 is the stripe light pattern spatially coded by a 3-bit gray code. A stripe light pattern 180 is the stripe light pattern in which the light and dark portions of the stripe light pattern 20 are reversed. The six different stripe light patterns are projected onto an object, and the object onto which the stripe light patterns are projected is captured.
FIG. 18B is a graph illustrating a relationship between the luminance of the captured image data and the horizontal coordinate x. A luminance line 181 is the luminance line in the vicinity of boundary position of image data captured using any of the stripe light pattern 20.
A luminance line 182 is the luminance line of image data captured using a reversion pattern light. A relative position on the horizontal coordinate of the luminance line 182 is set as similar to the relative position of the luminance line 181. The luminance lines 181 and 182 intersect with each other at a position “b”. The position “b” determined by the above process is taken as a boundary position. What is described above is the complementary pattern projection method.
The number of patterns required for the two methods are at least 2N in the complementary pattern projection method and (N+2) in the average image comparison method, at an N-bit spatial coding. When N=1, the number of the patterns required for the average image comparison method is greater by one than that for the complementary pattern projection method. When N is greater than 1, the number of the patterns required for the complementary pattern projection method is greater than that for the average image comparison method.
Actually, at N=1, only two areas are coded not to allow the three dimensional measurement to be performed, so that, in general, the number of the patterns to be captured for the complementary pattern projection method becomes greater than that for the average image comparison method. The two methods are described using the stripe light pattern of the gray code. The same holds true for the binary code illustrated in FIGS. 14A, 14B, and 14C. When the spatial coding method is used, the boundary position between the light and dark portions is determined in general using any of the above methods.
The advantage and the disadvantage of the two methods described above are summarized below. In the complementary pattern projection method, two images projected onto an object are used to allow canceling influence due to the shape and the reflectance ratio of the object. For this reason, the complementary pattern projection method can more accurately determine the boundary position than the average image comparison method.
However, in general, the number of the patterns to be projected for the complementary pattern projection method is greater than that for the average image comparison method. Particularly, in the three dimensional measurement, measurement is performed generally in higher bits of 8 bits or 9 bits to double the number of the patterns to be projected, increasing a measuring time period. On the other hand, the number of the patterns to be projected for the average image comparison method is smaller than that for the complementary pattern projection method to enable reducing a measuring time period. However, the average image comparison method more probably produces errors than the complementary pattern projection method in calculating the boundary position.
For example, the boundary position is determined by the average between the whole illumination pattern and the whole blackout pattern to produce errors owing to influence due to the shape and the reflectance ratio of the object. Furthermore, the boundary position is determined based upon the average, so that it is not always reasonable.
In an actual measurement, the complementary pattern projection method and the average image comparison method are different in boundary positions by several pixels, which can extend on the order of millimeters. As described above, it is difficult for conventional technique to accurately and quickly determine the boundary position between the light and dark portions.